#include <stdio.h>

const int N = 105;

struct node
{
	int id;
	int nextid;
	int data;
}nodes[N];

int main()
{
	int n, m;
	scanf("%d %d",&n,&m);

	nodes[0].nextid = 1;
	for (int i = 1; i <= n; i++)
	{
		nodes[i].id = 1;
		nodes[i].nextid = i + 1;
	}
	nodes[n].nextid = 1;

	int now = 1, prev = 1;
	while ((n--) > 1)
	{
		for (int i = 1; i < m; i++)
		{
			prev = now;
			now = nodes[i].nextid;
		}
		printf("%d ", nodes[now].id);
		nodes[prev].nextid = nodes[now].nextid;
		now = nodes[now].nextid;
	}

	printf("%d ", nodes[now].nextid);
	return 0;
}